<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.4"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Flow: log/config.hpp File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">Flow<span id="projectnumber">&#160;2.0.0</span>
   </div>
   <div id="projectbrief">Flow project: Full implementation reference.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_9381a7bbd03577d6d8720c7f35c94ffa.html">log</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#namespaces">Namespaces</a> &#124;
<a href="#define-members">Macros</a>  </div>
  <div class="headertitle"><div class="title">config.hpp File Reference</div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &quot;<a class="el" href="log_8hpp_source.html">flow/log/log.hpp</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="component__cfg_8hpp_source.html">flow/log/detail/component_cfg.hpp</a>&quot;</code><br />
<code>#include &lt;boost/unordered_map.hpp&gt;</code><br />
<code>#include &lt;atomic&gt;</code><br />
<code>#include &lt;typeinfo&gt;</code><br />
<code>#include &lt;utility&gt;</code><br />
</div>
<p><a href="config_8hpp_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Config.html">flow::log::Config</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Class used to configure the filtering and logging behavior of <code><a class="el" href="classflow_1_1log_1_1Logger.html" title="Interface that the user should implement, passing the implementing Logger into logging classes (Flow&#39;...">Logger</a></code>s; its use in your custom <code><a class="el" href="classflow_1_1log_1_1Logger.html" title="Interface that the user should implement, passing the implementing Logger into logging classes (Flow&#39;...">Logger</a></code>s is optional but encouraged; supports dynamically changing filter settings even while concurrent logging occurs.  <a href="classflow_1_1log_1_1Config.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structflow_1_1log_1_1Config_1_1Component__config.html">flow::log::Config::Component_config</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">The set of config stored for each distinct (as determined by <a class="el" href="classflow_1_1log_1_1Component.html#a3ff8ff4d75add447b3e10ded5430833d" title="Returns typeid(Payload), where Payload was the template param used when calling the originating one-a...">Component::payload_type()</a>, essentially C++ built-in <code>std::type_info</code>) component payload type (in English &ndash; component <code>enum class</code>).  <a href="structflow_1_1log_1_1Config_1_1Component__config.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Config_1_1Atomic__raw__sev.html">flow::log::Config::Atomic_raw_sev</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Trivial wrapper of <code>atomic&lt;raw_sev_t&gt;</code> which adds a couple of things to make it possible to construct, and therefore use, a <code>vector</code> of such <code>atomic</code>s.  <a href="classflow_1_1log_1_1Config_1_1Atomic__raw__sev.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="namespaces" name="namespaces"></a>
Namespaces</h2></td></tr>
<tr class="memitem:namespaceflow"><td class="memItemLeft" align="right" valign="top">namespace &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceflow.html">flow</a></td></tr>
<tr class="memdesc:namespaceflow"><td class="mdescLeft">&#160;</td><td class="mdescRight">Catch-all namespace for the Flow project: A collection of various production-quality modules written in modern C++17, originally by ygoldfel. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:namespaceflow_1_1log"><td class="memItemLeft" align="right" valign="top">namespace &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceflow_1_1log.html">flow::log</a></td></tr>
<tr class="memdesc:namespaceflow_1_1log"><td class="mdescLeft">&#160;</td><td class="mdescRight">Flow module providing logging functionality. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="define-members" name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a4c7537066356b7dcb9b9090fc98a38d2"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="config_8hpp.html#a4c7537066356b7dcb9b9090fc98a38d2">FLOW_LOG_CONFIG_COMPONENT_PAYLOAD_TYPE_DICT_BY_PTR</a>&#160;&#160;&#160;value_for_exposition</td></tr>
<tr class="memdesc:a4c7537066356b7dcb9b9090fc98a38d2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Macro (preprocessor symbol) to optionally set (when building Flow and translation units that use <a class="el" href="classflow_1_1log_1_1Config.html" title="Class used to configure the filtering and logging behavior of Loggers; its use in your custom Loggers...">flow::log::Config</a>) to override a certain <a class="el" href="classflow_1_1log_1_1Config.html" title="Class used to configure the filtering and logging behavior of Loggers; its use in your custom Loggers...">flow::log::Config</a> internal behavior that can affect <a class="el" href="classflow_1_1log_1_1Logger.html#ac8a2e7a33fe3fbc0c29ead62ed98c022" title="Given attributes of a hypothetical message that would be logged, return true if that message should b...">flow::log::Logger::should_log()</a> perf.  <a href="config_8hpp.html#a4c7537066356b7dcb9b9090fc98a38d2">More...</a><br /></td></tr>
<tr class="separator:a4c7537066356b7dcb9b9090fc98a38d2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a432ef317310a3c5e0f691f092e80494f"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="config_8hpp.html#a432ef317310a3c5e0f691f092e80494f">FLOW_LOG_CONFIG_COMPONENT_PAYLOAD_TYPE_DICT_BY_VAL</a>&#160;&#160;&#160;value_for_exposition</td></tr>
<tr class="memdesc:a432ef317310a3c5e0f691f092e80494f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Cousin of <a class="el" href="config_8hpp.html#a4c7537066356b7dcb9b9090fc98a38d2" title="Macro (preprocessor symbol) to optionally set (when building Flow and translation units that use flow...">FLOW_LOG_CONFIG_COMPONENT_PAYLOAD_TYPE_DICT_BY_PTR</a>, similarly affecting a related behavior.  <a href="config_8hpp.html#a432ef317310a3c5e0f691f092e80494f">More...</a><br /></td></tr>
<tr class="separator:a432ef317310a3c5e0f691f092e80494f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a4c7537066356b7dcb9b9090fc98a38d2" name="a4c7537066356b7dcb9b9090fc98a38d2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4c7537066356b7dcb9b9090fc98a38d2">&#9670;&nbsp;</a></span>FLOW_LOG_CONFIG_COMPONENT_PAYLOAD_TYPE_DICT_BY_PTR</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define FLOW_LOG_CONFIG_COMPONENT_PAYLOAD_TYPE_DICT_BY_PTR&#160;&#160;&#160;value_for_exposition</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Macro (preprocessor symbol) to optionally set (when building Flow and translation units that use <a class="el" href="classflow_1_1log_1_1Config.html" title="Class used to configure the filtering and logging behavior of Loggers; its use in your custom Loggers...">flow::log::Config</a>) to override a certain <a class="el" href="classflow_1_1log_1_1Config.html" title="Class used to configure the filtering and logging behavior of Loggers; its use in your custom Loggers...">flow::log::Config</a> internal behavior that can affect <a class="el" href="classflow_1_1log_1_1Logger.html#ac8a2e7a33fe3fbc0c29ead62ed98c022" title="Given attributes of a hypothetical message that would be logged, return true if that message should b...">flow::log::Logger::should_log()</a> perf. </p>
<p >Typically there is no need to set this, especially if when calling <a class="el" href="classflow_1_1log_1_1Config.html#a9b7ba819538d221f190e044cfa6220db" title="Registers a generically-typed enum class that represents the full set of the calling module&#39;s possibl...">flow::log::Config::init_component_to_union_idx_mapping()</a> one always provides arg value <code>component_payload_type_info_ptr_is_uniq = false</code> (safe default). (Note: It is recommended to in fact set it to <code>true</code>.) So, if relevant, and if your benchmarks show <code>should_log()</code> is using significant processor cycles, it can make sense to experiment by setting this to other values; namely:</p>
<ul>
<li><code>"::flow::log::Component_payload_type_dict_by_ptr_via_tree_map"</code></li>
<li><code>"::flow::log::Component_payload_type_dict_by_ptr_via_s_hash_map"</code></li>
<li><code>"::flow::log::Component_payload_type_dict_by_ptr_via_b_hash_map"</code></li>
<li><code>"::flow::log::Component_payload_type_dict_by_ptr_via_array"</code></li>
<li><code>"::flow::log::Component_payload_type_dict_by_ptr_via_sorted_array"</code></li>
</ul>
<p >Adventurous types can also implement their own such a template, as long as it implements the semantics of <code>"flow::log::Component_payload_type_dict_by_ptr_via_tree_map"</code>.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classflow_1_1log_1_1Config.html" title="Class used to configure the filtering and logging behavior of Loggers; its use in your custom Loggers...">flow::log::Config</a> class doc header Performance section for an overall recipe.</dd></dl>
<h3>Impl: The chosen default</h3>
<p >Regarding the default value: Briefly (this requires understanding of Component_payload_type_dict): All choices are pretty good, as all rely on pointers and not long type names, but reassuringly <code>std::unordered_map</code> (with <code>boost::unordered_map</code> very close) tends to be the best or close, though with only 2 types in the map linear-search array can be marginally better. (GNU STL used here; LLVM STL might be different.) </p>

<p class="definition">Definition at line <a class="el" href="config_8hpp_source.html#l00059">59</a> of file <a class="el" href="config_8hpp_source.html">config.hpp</a>.</p>

</div>
</div>
<a id="a432ef317310a3c5e0f691f092e80494f" name="a432ef317310a3c5e0f691f092e80494f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a432ef317310a3c5e0f691f092e80494f">&#9670;&nbsp;</a></span>FLOW_LOG_CONFIG_COMPONENT_PAYLOAD_TYPE_DICT_BY_VAL</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define FLOW_LOG_CONFIG_COMPONENT_PAYLOAD_TYPE_DICT_BY_VAL&#160;&#160;&#160;value_for_exposition</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Cousin of <a class="el" href="config_8hpp.html#a4c7537066356b7dcb9b9090fc98a38d2" title="Macro (preprocessor symbol) to optionally set (when building Flow and translation units that use flow...">FLOW_LOG_CONFIG_COMPONENT_PAYLOAD_TYPE_DICT_BY_PTR</a>, similarly affecting a related behavior. </p>
<p >Again typically there is no need to set this, especially if when calling <a class="el" href="classflow_1_1log_1_1Config.html#a9b7ba819538d221f190e044cfa6220db" title="Registers a generically-typed enum class that represents the full set of the calling module&#39;s possibl...">flow::log::Config::init_component_to_union_idx_mapping()</a> one always provides arg value <code>component_payload_type_info_ptr_is_uniq = true</code>. Otherwise, and if your benchmarks show <code>should_log()</code> is using significant processor cycles, it can make sense to experiment by setting this to other values; namely:</p>
<ul>
<li><code>"::flow::log::Component_payload_type_dict_by_val_via_tree_map"</code></li>
<li><code>"::flow::log::Component_payload_type_dict_by_val_via_s_hash_map"</code></li>
<li><code>"::flow::log::Component_payload_type_dict_by_val_via_b_hash_map"</code></li>
<li><code>"::flow::log::Component_payload_type_dict_by_val_via_array"</code></li>
<li><code>"::flow::log::Component_payload_type_dict_by_val_via_sorted_array"</code></li>
</ul>
<p >Adventurous types can also implement their own such a template, as long as it implements the semantics of <code>"flow::log::Component_payload_type_dict_by_val_via_tree_map"</code>.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classflow_1_1log_1_1Config.html" title="Class used to configure the filtering and logging behavior of Loggers; its use in your custom Loggers...">flow::log::Config</a> class doc header Performance section for an overall recipe.</dd></dl>
<h3>Impl: The chosen default</h3>
<p >Regarding the default value: This is the slower lookup type, and may be irrelevant, but within this category we can still do better or worse. As noted in <a class="el" href="classflow_1_1log_1_1Config.html#aab7de884a6d86042404dd1cb04691f02" title="Short-hand for fast-lookup map from distinct Component_payload type to the config for that component ...">flow::log::Config::Component_payload_type_to_cfg_map</a> doc header by far the worst are the hash-maps; so not that. As of this writing that leaves sorted-map-based; linear-search array; and binary-search array. Empirically (presumably due to the &lt;= ~10 # of types in map) the linear-search array is best, though when closer to 10 types for some hardware binary-search array works best. They are close, though, and across different hardware/software settings we've tried to run the unit-test benchmark it's tough to get completely solid results that would hold for everyone. (GNU STL used here; LLVM STL might be different.) </p>

<p class="definition">Definition at line <a class="el" href="config_8hpp_source.html#l00090">90</a> of file <a class="el" href="config_8hpp_source.html">config.hpp</a>.</p>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Mar 28 2025 22:55:35 for Flow by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.4
</small></address>
</body>
</html>
